<template>
    <div class="chart"></div>
</template>

<script>
    export default {
        name: "PassengerVolume",
        data() {
            return{
                myChart:{}
            }
        },
        mounted() {
            this.draw()
        },
        methods: {
            draw() {
                this.myChart = this.$echarts.init(document.querySelector(".bar .chart"))
                let option={
                    color: ['#2f89cf'],
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: { // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        top: "10px",
                        left: '0%',
                        right: '0%',
                        bottom: '4%',
                        containLabel: true
                    },
                    xAxis: [{
                        type: 'category',
                        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                            color: "rgba(255,255,255,0.6)",
                            fontSize: '12'

                        },
                        axisLine: {
                            show: false
                        }
                    }],
                    yAxis: [{
                        type: 'value',
                        axisLabel: {
                            color: "rgba(255,255,255,0.6)",
                            fontSize: '12'

                        },
                        axisLine: {
                            lineStyle: {
                                color: "rgba(255,255,255,0.1)"
                            },
                            width: 1,
                            type: 'solid'
                        },
                        splitLine: {
                            lineStyle: {
                                color: 'rgba(255,255,255,0.1)'
                            },
                            width: 1
                        }
                    }],
                    series: [{
                        name: '直接访问',
                        type: 'bar',
                        barWidth: '35%',
                        data: [10, 52, 200, 334, 390, 330, 220],
                        itemStyle: {
                            barBorderRadius: 5
                        }
                    }]
                }
                this.myChart.setOption(option)
            },
            resize(){
                this.myChart.resize()
            }
        }
    }
</script>

<style scoped>
    .chart {
        height: 3rem;
    }
</style>
